<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增库存')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-repertory-add">
            <input id="treeId" name="deptId" type="hidden" th:value="100"   />
            <div class="form-group">
                <label class="col-sm-3 control-label">门店：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName"  readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品id：</label>
                <div class="col-sm-8">
                    <input name="goodsId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品数量：</label>
                <div class="col-sm-8">
                    <input name="quantity" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="lastUpdateTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">条码：</label>
                <div class="col-sm-8">
                    <input name="barCode" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "goods/repertory"
        $("#form-repertory-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-repertory-add').serialize());
            }
        }

        $("input[name='lastUpdateTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });


        /*门店管理-新增-选择父门店树*/
        function selectDeptTree() {
            var xprefix = ctx + "system/dept";
            var options = {
                title: '门店选择',
                width: "380",
                url: xprefix + "/selectDeptTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var tid=body.find('#treeId').val();
            var tval=body.find('#treeName').val();
            $("#treeId").val(tid);
            $("#treeName").val(tval);
            layer.close(index);
        }
    </script>
</body>
</html>